
#ifndef __CE_VIRTUALCLOCK_H__
#define __CE_VIRTUALCLOCK_H__

#include <cegfx/ceexport.h>
/**
 * \brief Implements a millisecond precise timestamping System.
 * 
 * By using the method ceVirtualClock::GetMilliseconds() the user
 * can retrieve a timestamp unique for the entire frame. 
 *
 * By using the method ceVirtualClock::GetCurrentMilliseconds() 
 * the user can retrieve the \a current timestamp.
 */
class CE_GFX_API ceVirtualClock
{
private:
	long time;

	static ceVirtualClock* clock;

	ceVirtualClock ();
	void PrivTick ();
	long PrivGetMilliseconds ();

	static ceVirtualClock* Acquire ();

public:

	/**
	 * \brief Update of the frame time.
	 * 
	 * At the start of each frame this method needs to be called \a once.
	 * This is done at the beginning of each frame by the engine.
	 * 
	 * So it's not needed for the user to call this method.
	 */
	static void Tick ();

	/**
	 * \brief Returns the timestamp of the beginning of the current frame.
	 * 
	 * This is the number of milliseconds that passed from the bootup of
	 * the system until the current frame has started. This is the timestamp
	 * when \a Tick() was called.
	 *
	 * \return The timestamp of the beginning of the current frame.
	 */
	static long GetMilliseconds ();

	/**
	 * \brief Returns the current timestamp.
	 * 
	 * This is the number of milliseconds that passed from the bootup of
	 * the system until this method called.
	 *
	 * \return The current timestamp
	 */
	static long GetCurrentMilliseconds ();

};

typedef ceVirtualClock ceVClock;
typedef ceVirtualClock ceVirtClock;



#endif /* ! __CE_VIRTUALCLOCK_H__ */

